<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <title>售卖机数量看板</title>
    <link rel="stylesheet" href="../../library/jquery.mobile-1.4.5/jquery.mobile-1.4.5.min.css">
    <link rel="stylesheet" href="machUnusual.css">
    <script src="../../library/jquery/jquery-1.11.3.js"></script>
    <script src="../../library/jquery.mobile-1.4.5/jquery.mobile-1.4.5.min.js"></script>
    <style>
        .selectAccess .ui-checkbox{
            display: block;
        }
    </style>
</head>
<body>
<!--主页面-->
<div data-role="page" id="pageone">
    <div data-role="header" data-theme="a" data-position="fixed">
        <a href="index.html" target="_self" class="ui-btn ui-btn-b ui-icon-carat-l ui-btn-icon-notext" data-transition="slide" data-direction="reverse"><</a>
        <h2>机台异常看板</h2>
    </div>
    <div data-role="main" class="ui-content">
        <div id="monMachdrill" class="draw" style="display: none"></div>

    </div>
</div>
<script src="../../library/Highcharts-6.0.3/highcharts.js"></script>
<script src="../../library/Highcharts-6.0.3/modules/exporting.js"></script>
<script src="../../library/Highcharts-6.0.3/modules/offline-exporting.js"></script>
<script src="../../library/vue/vue.js"></script>
<script src="../../library/vue/vue-resource.js"></script>
<script src="../../controller/drawStack.js"></script>
<script>
    $(document).ready(function(){
        //获取浏览器地址中的参数
        var url=window.location.href;
        var lab=decodeURI(getParamer('lab'));
        var modelsend=decodeURI(getParamer('modelSend'));
        modelsend.dillName=lab;
        var model=jQuery.parseJSON(modelsend);
        model.dillName = lab;
        console.log(model);
        console.log(modelsend);
        $.ajax({
            url: "https://up-bi.pec.com.cn/data-center/machinesAbnoralBoard/getMachinesAbnormalBoardInfo?token="+sessionStorage.getItem('userId'),
            type: "POST",
            data:{"paramData":JSON.stringify(model)},
            success:function(data){
                console.log(data);
                console.log(lab)
                var str='';
                for(var i=0;i<data.data.length;i++){
                    str+='<div class="content">' +
                        '<p>'+data.data[i].machinesCode+'<span>'+data.data[i].abnormalDate+'</span></p>' +
                        '<p>'+data.data[i].detailAddress+'</p>';
                    if(data.data[i].abnormalInfo){
                        if(lab=='机台故障'){
                            str+='<p>故障原因:'+data.data[i].abnormalInfo+'</p>' ;
                        }else{
                            str+='<p>未交易:'+data.data[i].abnormalInfo+'</p>' ;

                        }

                    }else{
                        str+='<p></p>' ;

                    }
                        str+='</div>'
                }
                $("#monMachdrill").after(str)
            }
        });

    });
    //方法获取浏览器的url中的参数
    function getParamer(paramer){
        var url=window.location.href.split("?")[1];
        if(url.indexOf("&")>0){
            urlParamArry=url.split("&");
            for(var i=0; i<urlParamArry.length; i++){
                var paramerName=urlParamArry[i].split("=");
                if(paramer==paramerName[0]){
                    return paramerName[1];
                }
            }
        }else{
            var paramerValue=url.split("=")[1];
            return paramerValue;
        }
    }
</script>
</body>
</html>